//
//  DetailsTableViewCell.m
//  GiftNote
//
//  Created by lanou3g on 15/8/12.
//  Copyright (c) 2015年 GN. All rights reserved.
//

#import "DetailsTableViewCell.h"
#import "Screen.h"
@interface DetailsTableViewCell ()<UIWebViewDelegate>

@property (nonatomic,retain) UIWebView *webView1;

@end
@implementation DetailsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _webView1 = [[UIWebView alloc] initWithFrame:CGRectZero];
        _webView1.scrollView.bounces = NO;
        _webView1.delegate = self;
        [self.contentView addSubview:_webView1];
        
    }
    return self;
}

- (void)setDetailsCellModel:(ArtiollerModel *)detailsCellModel{
    _detailsCellModel = detailsCellModel;
   // [_webView1 loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",detailsCellModel.url]]]];
  
}

- (void)webViewDidFinishLoad:(UIWebView *)webView{
    CGFloat webHight = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] floatValue];
    _webView1.frame = CGRectMake(0, 0, SCREEN_WIDTH, webHight);
    
    [self.contentView addSubview:_webView1];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"webHight2" object:@(webHight)];
    
    
}



- (void)awakeFromNib {
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
